package com.example.mybatisplus.controller;

import com.example.mybatisplus.entity.Role;
import com.example.mybatisplus.entity.User;
import com.example.mybatisplus.service.RoleService;
import com.example.mybatisplus.service.User2Service;
import com.example.mybatisplus.service.UserService;
import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@Slf4j
@RestController
public class LoginController  {
    @Autowired
    private UserService userService;
    @Autowired
    private User2Service user2Service;
    @Autowired
    private RoleService roleService;

    @GetMapping("/getUser")
    public User getUser(String name){
        return userService.findUserByName(name);
    }

    @GetMapping("/getUser2")
    public User getUser2(String name){
        return user2Service.findUserByName(name);
    }

    @GetMapping("/getRole")
    public Role getRole(String id){
        return roleService.getById(id);
    }

}
